import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:largefriends/res/lf_double_ext.dart';
import 'package:largefriends/res/lf_string_ext.dart';

import '../../../res.dart';
import '../../res/lf_fonts.dart';
import '../../res/lf_text_style.dart';
import '../../res/lf_widget_ext.dart';
import '../../widgets/lf_button.dart';

class LfContactEmptyWidget extends StatelessWidget {
  final String? icon;
  final String? title;
  final String? content;
  final String? actionTitle;
  final Function()? action;

  const LfContactEmptyWidget(
      {Key? key,
      this.icon,
      this.title,
      this.content,
      this.actionTitle,
      this.action})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(builder: (context, constant) {
      return Container(
        height: constant.maxHeight,
        padding: EdgeInsets.symmetric(horizontal: 30.w),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Image.asset(icon ?? Res.common_empty_no_user),
            16.h.sbh,
            Text(
              title?.toUpperCase() ?? "",
              style: lfTextStyle(sp: 18.sp, fontFamily: fontMedium),
              textAlign: TextAlign.center,
            ),
            20.h.sbh,
            Text(
              content ?? "",
              style: lfTextStyle(sp: 16.sp, fontFamily: fontRegular),
              textAlign: TextAlign.center,
            ),
            actionTitle.isNullOrEmpty
                ? empty
                : Padding(
                    padding: EdgeInsets.only(top: 30.h),
                    child: LfButton(
                      onPress: () {
                        action?.call();
                      },
                      text: actionTitle!.toUpperCase(),
                      enabled: true,
                    ),
                  ),
            20.h.sbh,
          ],
        ),
      );
    });
  }
}
